A fork()
command in C creates a child process with all the context of a parent process and returns the ID of this child process. Both processes (new child and old parent) continue from the return of the fork
call.
The fork returns
void main(){
if(fork()
// both processes will continue from here
//fork() will return 0 for child and 1 for parent
!= 0){
printf("Am Parent\n");
}
else{
printf("Am Child);
}
}